home *** CD-ROM | disk | FTP | other *** search
- Path: ilnews.iil.intel.com!pauls
- From: Michael Tiomkin <mtiomkin@iil.intel.com>
- Newsgroups: comp.lang.c
- Subject: Re: Why won't this compile????
- Date: 18 Feb 1996 11:43:31 GMT
- Organization: Intel Israel
- Message-ID: <4g73d3$1fk0@ilx018.iil.intel.com>
- References: <4g50et$9lh@steel.interlog.com>
- NNTP-Posting-Host: ilnt169.iil.intel.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
-
- your program isn't exactly ANSI C: in the last printf, its
- 1st argument, intended to be a char string, doesn't end with a
- double quote. This makes the compiler understand the code in
- a different way.
-
- Good luck!
-
- Michael
-
- kingkaos@interlog.com (King Kaos) wrote:
- >
- > Hi. Can someone please explain why this program won't
- >compile without errors? I am using Power C under DOS.
- >
- >
- >Heres the ANSI-C code:
- >
- >#include <stdio.h>
- >#include <stdlib.h>
- >
- >void swap(int *, int *);
- >
- >main()
- >{
- > int var1, var2;
- >
- > var1 = 25;
- > var2 = 99;
- > printf("Variables before swap");
- > printf("var1 = %d , var2 = %d\n",var1,var2);
- >
- > swap(&var1, &var2);
- > printf("Variables after swap");
- > printf("var1 = %d , var2 = %d\n,var1,var2); /* !! */
- >}
- >
- >void swap(int *ptr1,int *ptr2)
- >{
- > int temp;
- > temp = *ptr1;
- > *ptr1 = *ptr2;
- > *ptr2 = temp;
- >}
- >
- >-----------------------------
- >And, heres the C.ERR file:
- >
- >pointc~1.txt(18):}
- >**************** ^202
- > 202: String constant cannot span lines
- >------------------------------------------------------------
- >pointc~1.txt(20):void swap(int *ptr1,int *ptr2)
- >**************** ^ 4, 14 ^ 6 ^104,222, 6,104,222
- > 4: ')' expected
- > 14: ';' expected
- > 6: Illegal symbol
- > 104: Undeclared identifier
- > 222: Warning - Pointer does not match scalar (int, long, etc)
- >------------------------------------------------------------
- >pointc~1.txt(21):{
- >**************** ^ 14
- > 14: ';' expected
- >------------------------------------------------------------
- >pointc~1.txt(23): temp = *ptr1;
- >**************** ^104,141
- > 104: Undeclared identifier
- > 141: Type of variable is not pointer
- >------------------------------------------------------------
- >pointc~1.txt(24): *ptr1 = *ptr2;
- >**************** ^104,141,104,141
- > 104: Undeclared identifier
- > 141: Type of variable is not pointer
- >------------------------------------------------------------
- >pointc~1.txt(25): *ptr2 = temp;
- >**************** ^104,141
- > 104: Undeclared identifier
- > 141: Type of variable is not pointer
- >------------------------------------------------------------
- >pointc~1.txt(26):}
- >**************** ^ 9
- > 9: Right braces expected
- >------------------------------------------------------------
- >
- >
- >Any help will be appericated. Please email respones directly to
- >me. Thank's.
- >
- >
- >
- > KING KAOS
- >
-
-
-